<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>数组解构赋值</title>
		<script type="text/javascript">
			let arr = [1,2,3];
			let [a,b,c] = arr;		//等号两边的结构必须一样,如果左边有多的变量，那么这个值是undefined
//			let [a,b,c,d] = arr;
//			console.log(a,b,c,d);		//1 2 3 undefined
			
			const fn = (a,...args) => {
				console.log(args);
			}
			fn(1,2,3);
			
			//使用扩展运算符
			
			
		</script>
	</head>
	<body>
		<div>1</div>
		<div>2</div>
		<div>3</div>
		<div>4</div>
		<div>5</div>
		<div>6</div>
		<div>7</div>
		<div>8</div>
		<script type="text/javascript">
			let divs = document.querySelectorAll('div');
			console.log(divs);
			//将他转换为真正的数组
			let realArr = [...divs];
			console.log(realArr);
			
			let arr1 = {
				'0' : '张三',
				'1' : '李四',
				'2' : '王五',
				'length' : 3
			}
			let Arr = Array.from(arr1);
			console.log(Arr);
			console.log(Object.values(arr1));
			
			let arr2 = [1,2,3,4];
			let res = arr2.findIndex((item,index) => {
				return item == 3;
			});
			console.log(res);
			const se = new Set(['a','b']);
			console.log(se)
		</script>
	</body>
</html>
